package com.feige.controller;


import com.feige.pojo.UserAnswer;
import com.feige.result.AjaxResult;
import com.feige.service.UserAnswerService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author feige
 * @since 2021-04-01
 */
@Api(tags = "用户答案前端控制器")
@RestController
@RequestMapping("/exercise/user-answer")
public class UserAnswerController {

    @Resource
    private UserAnswerService userAnswerService;



    @ApiOperation(value = "批改和保存用户答案")
    @PostMapping("/save/{exerciseTitleId}")
    public AjaxResult save(@RequestHeader("token") String token , @PathVariable String exerciseTitleId, @RequestBody List<UserAnswer> userAnswers){
        return userAnswerService.correctAndSave(token,exerciseTitleId,userAnswers);
    }
}

